using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Instances.Contracts;
using WhsFacebook.Net.Contracts;

namespace WhsFacebook.Whs.Service
{
    partial class SingletonService
    {
        public DateTime GetLastUpdateCheck()
        {
            try
            {
                return UpdateChecker.Instance.LastCheck;
            }
            catch (Exception e)
            {
                _log.Error("GetLastUpdateCheck() failed", e);

                throw;
            }
        }

        public ReleaseInfo GetNewerVersion()
        {
            try
            {
                return UpdateChecker.Instance.NewVersion;
            }
            catch (Exception e)
            {
                _log.Error("GetNewerVersion() failed", e);

                throw;
            }
        }

        public ReleaseInfo CheckNewerVersionNow()
        {
            try
            {
                var i = UpdateChecker.Instance;

                i.DoCheckManually();

                return i.NewVersion;
            }
            catch (Exception e)
            {
                _log.Error("CheckNewerVersionNow() failed", e);

                throw;
            }
        }
    }
}
